com.rscja.team.qcom.usb.pl2302

## Interface UsbSerialPort_qcom

- All Known Implementing Classes:
    UsbSerialPortImpl_qcom

      public interface UsbSerialPort_qcom

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `DATABITS_5` 5 data bits.
    `static int` | `DATABITS_6` 6 data bits.
    `static int` | `DATABITS_7` 7 data bits.
    `static int` | `DATABITS_8` 8 data bits.
    `static int` | `FLOWCONTROL_NONE` No flow control.
    `static int` | `FLOWCONTROL_RTSCTS_IN` RTS/CTS input flow control.
    `static int` | `FLOWCONTROL_RTSCTS_OUT` RTS/CTS output flow control.
    `static int` | `FLOWCONTROL_XONXOFF_IN` XON/XOFF input flow control.
    `static int` | `FLOWCONTROL_XONXOFF_OUT` XON/XOFF output flow control.
    `static int` | `PARITY_EVEN` Even parity.
    `static int` | `PARITY_MARK` Mark parity.
    `static int` | `PARITY_NONE` No parity.
    `static int` | `PARITY_ODD` Odd parity.
    `static int` | `PARITY_SPACE` Space parity.
    `static int` | `STOPBITS_1` 1 stop bit.
    `static int` | `STOPBITS_1_5` 1.5 stop bits.
    `static int` | `STOPBITS_2` 2 stop bits.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Closes the port.
    `boolean` | `getCD()` Gets the CD (Carrier Detect) bit from the underlying UART.
    `boolean` | `getCTS()` Gets the CTS (Clear To Send) bit from the underlying UART.
    `boolean` | `getDSR()` Gets the DSR (Data Set Ready) bit from the underlying UART.
    `boolean` | `getDTR()` Gets the DTR (Data Terminal Ready) bit from the underlying UART.
    `int` | `getPortNumber()` Port number within driver.
    `boolean` | `getRI()` Gets the RI (Ring Indicator) bit from the underlying UART.
    `boolean` | `getRTS()` Gets the RTS (Request To Send) bit from the underlying UART.
    `java.lang.String` | `getSerial()` The serial number of the underlying UsbDeviceConnection, or `null`.
    `void` | `open(android.hardware.usb.UsbDeviceConnection connection)` Opens and initializes the port.
    `boolean` | `purgeHwBuffers(boolean flushRX, boolean flushTX)` Flush non-transmitted output data and / or non-read input data
    `int` | `read(byte[] dest, int timeoutMillis)` Reads as many bytes as possible into the destination buffer.
    `void` | `setDTR(boolean value)` Sets the DTR (Data Terminal Ready) bit on the underlying UART, if supported.
    `boolean` | `setParameters()`
    `void` | `setParameters(int baudRate, int dataBits, int stopBits, int parity)` Sets various serial port parameters.
    `void` | `setRTS(boolean value)` Sets the RTS (Request To Send) bit on the underlying UART, if supported.
    `int` | `write(byte[] src, int timeoutMillis)` Writes as many bytes as possible from the source buffer.

- - ### Field Detail

    - #### DATABITS_5

          static final int DATABITS_5

      5 data bits.
      See Also:
        Constant Field Values

    - #### DATABITS_6

          static final int DATABITS_6

      6 data bits.
      See Also:
        Constant Field Values

    - #### DATABITS_7

          static final int DATABITS_7

      7 data bits.
      See Also:
        Constant Field Values

    - #### DATABITS_8

          static final int DATABITS_8

      8 data bits.
      See Also:
        Constant Field Values

    - #### FLOWCONTROL_NONE

          static final int FLOWCONTROL_NONE

      No flow control.
      See Also:
        Constant Field Values

    - #### FLOWCONTROL_RTSCTS_IN

          static final int FLOWCONTROL_RTSCTS_IN

      RTS/CTS input flow control.
      See Also:
        Constant Field Values

    - #### FLOWCONTROL_RTSCTS_OUT

          static final int FLOWCONTROL_RTSCTS_OUT

      RTS/CTS output flow control.
      See Also:
        Constant Field Values

    - #### FLOWCONTROL_XONXOFF_IN

          static final int FLOWCONTROL_XONXOFF_IN

      XON/XOFF input flow control.
      See Also:
        Constant Field Values

    - #### FLOWCONTROL_XONXOFF_OUT

          static final int FLOWCONTROL_XONXOFF_OUT

      XON/XOFF output flow control.
      See Also:
        Constant Field Values

    - #### PARITY_NONE

          static final int PARITY_NONE

      No parity.
      See Also:
        Constant Field Values

    - #### PARITY_ODD

          static final int PARITY_ODD

      Odd parity.
      See Also:
        Constant Field Values

    - #### PARITY_EVEN

          static final int PARITY_EVEN

      Even parity.
      See Also:
        Constant Field Values

    - #### PARITY_MARK

          static final int PARITY_MARK

      Mark parity.
      See Also:
        Constant Field Values

    - #### PARITY_SPACE

          static final int PARITY_SPACE

      Space parity.
      See Also:
        Constant Field Values

    - #### STOPBITS_1

          static final int STOPBITS_1

      1 stop bit.
      See Also:
        Constant Field Values

    - #### STOPBITS_1_5

          static final int STOPBITS_1_5

      1.5 stop bits.
      See Also:
        Constant Field Values

    - #### STOPBITS_2

          static final int STOPBITS_2

      2 stop bits.
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### setParameters

          boolean setParameters()

    - #### getPortNumber

          int getPortNumber()

      Port number within driver.

    - #### getSerial

          java.lang.String getSerial()

      The serial number of the underlying UsbDeviceConnection, or `null`.

    - #### open

          void open(android.hardware.usb.UsbDeviceConnection connection)
             throws java.io.IOException

      Opens and initializes the port. Upon success, caller must ensure that is eventually called.
      Parameters:
        `connection` - an open device connection, acquired with `UsbManager.openDevice(android.hardware.usb.UsbDevice)`
      Throws:
        `java.io.IOException` - on error opening or initializing the port.

    - #### close

          void close()
              throws java.io.IOException

      Closes the port.
      Throws:
        `java.io.IOException` - on error closing the port.

    - #### read

          int read(byte[] dest,
                   int timeoutMillis)
            throws java.io.IOException

      Reads as many bytes as possible into the destination buffer.
      Parameters:
        `dest` - the destination byte buffer
        `timeoutMillis` - the timeout for reading
      Returns:
        the actual number of bytes read
      Throws:
        `java.io.IOException` - if an error occurred during reading

    - #### write

          int write(byte[] src,
                    int timeoutMillis)
             throws java.io.IOException

      Writes as many bytes as possible from the source buffer.
      Parameters:
        `src` - the source byte buffer
        `timeoutMillis` - the timeout for writing
      Returns:
        the actual number of bytes written
      Throws:
        `java.io.IOException` - if an error occurred during writing

    - #### setParameters

          void setParameters(int baudRate,
                             int dataBits,
                             int stopBits,
                             int parity)
                      throws java.io.IOException

      Sets various serial port parameters.
      Parameters:
        `baudRate` - baud rate as an integer, for example `115200`.
        `dataBits` - one of `DATABITS_5`, `DATABITS_6`, `DATABITS_7`, or `DATABITS_8`.
        `stopBits` - one of `STOPBITS_1`, `STOPBITS_1_5`, or `STOPBITS_2`.
        `parity` - one of `PARITY_NONE`, `PARITY_ODD`, `PARITY_EVEN`, `PARITY_MARK`, or `PARITY_SPACE`.
      Throws:
        `java.io.IOException` - on error setting the port parameters

    - #### getCD

          boolean getCD()
                 throws java.io.IOException

      Gets the CD (Carrier Detect) bit from the underlying UART.
      Returns:
        the current state, or `false` if not supported.
      Throws:
        `java.io.IOException` - if an error occurred during reading

    - #### getCTS

          boolean getCTS()
                  throws java.io.IOException

      Gets the CTS (Clear To Send) bit from the underlying UART.
      Returns:
        the current state, or `false` if not supported.
      Throws:
        `java.io.IOException` - if an error occurred during reading

    - #### getDSR

          boolean getDSR()
                  throws java.io.IOException

      Gets the DSR (Data Set Ready) bit from the underlying UART.
      Returns:
        the current state, or `false` if not supported.
      Throws:
        `java.io.IOException` - if an error occurred during reading

    - #### getDTR

          boolean getDTR()
                  throws java.io.IOException

      Gets the DTR (Data Terminal Ready) bit from the underlying UART.
      Returns:
        the current state, or `false` if not supported.
      Throws:
        `java.io.IOException` - if an error occurred during reading

    - #### setDTR

          void setDTR(boolean value)
               throws java.io.IOException

      Sets the DTR (Data Terminal Ready) bit on the underlying UART, if supported.
      Parameters:
        `value` - the value to set
      Throws:
        `java.io.IOException` - if an error occurred during writing

    - #### getRI

          boolean getRI()
                 throws java.io.IOException

      Gets the RI (Ring Indicator) bit from the underlying UART.
      Returns:
        the current state, or `false` if not supported.
      Throws:
        `java.io.IOException` - if an error occurred during reading

    - #### getRTS

          boolean getRTS()
                  throws java.io.IOException

      Gets the RTS (Request To Send) bit from the underlying UART.
      Returns:
        the current state, or `false` if not supported.
      Throws:
        `java.io.IOException` - if an error occurred during reading

    - #### setRTS

          void setRTS(boolean value)
               throws java.io.IOException

      Sets the RTS (Request To Send) bit on the underlying UART, if supported.
      Parameters:
        `value` - the value to set
      Throws:
        `java.io.IOException` - if an error occurred during writing

    - #### purgeHwBuffers

          boolean purgeHwBuffers(boolean flushRX,
                                 boolean flushTX)
                          throws java.io.IOException

      Flush non-transmitted output data and / or non-read input data
      Parameters:
        `flushRX` - `true` to flush non-transmitted output data
        `flushTX` - `true` to flush non-read input data
      Returns:
        `true` if the operation was successful, or `false` if the operation is not supported by the driver or device
      Throws:
        `java.io.IOException` - if an error occurred during flush